import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const ADD_COUNT = 'ADD_COUNT'
const REMOVE_COUNT = 'REMOVE_COUNT'

export default new Vuex.Store({
  state: {
    token: '',
    userId: ''
  },
  mutations: {
    [ADD_COUNT] (state, token) {
      sessionStorage.setItem('token', token)
      state.token = token
    },
    [REMOVE_COUNT] (state, token) {
      sessionStorage.removeItem('token', token)
      state.token = token
    }
  }
})
